<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }

    body {
      background-color: #0c143d;
    }

    .box {
      display: flex;
      justify-content: space-around;
      align-items: flex-end;
      width: 800px;
      min-height: 300px;
      border-left: 1px solid #4b578f;
      border-bottom: 1px solid #4b578f;
      margin: 0 auto;
      padding-top: 50px;
      text-align: center;
      color: #9799ab;
    }

    .box>div {
      position: relative;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      width: 40px;
      height: 0;
      background: linear-gradient(#3c99ff, #4489d0, #2283e4);
      cursor: pointer;
      border-radius: 8px 8px 0 0;
      transition: all .2s;
    }

    .box>div:hover {

      animation: bg .5s alternate infinite;

    }

    @keyframes bg {
      to {
        box-shadow: 0 5px 29px rgb(53 111 226 / 88%);
        background: linear-gradient(#3c99ff, #68aff6, #2283e4);
      }
    }

    .box>div::after {
      content: '';
      position: absolute;
      bottom: 0;
      left: 50%;
      width: 2px;
      height: 10px;
      background-color: #4b578f;
      transform: translate(-50%, 100%);
    }

    .box div span {
      width: 60px;
      margin: -30px 0 -5px -6px;
    }

    .box div h4 {
      width: 70px;
      margin: 0 0 -35px -10px;
    }

    .title {
      margin-top: 50px;
      text-align: center;
      color: #9799ab;
    }
  </style>
</head>

<body>
  <h3 class="title">2099年季度销售数额（单位万）</h3>
  <div class="box">
    <!-- <div style="height: 123px;" title="第1季度-123万">
      <span>123万</span>
      <h4>第1季度</h4>
    </div>
    <div style="height: 156px;" title="第2季度-156万">
      <span>156万</span>
      <h4>第2季度</h4>
    </div>
    <div style="height: 120px;" title="第3季度-120万">
      <span>120万</span>
      <h4>第3季度</h4>
    </div>
    <div style="height: 210px;" title="第4季度-210万">
      <span>210万</span>
      <h4>第4季度</h4>
    </div> -->
  
  <script>
     //  1·用户输入 => 4次数据
    //  1·1声明数据，用来保存数据
    let arr = []//用来保存4次用户输入一个季度的数据
    //  1·2循环4次，每次用户输入一个季度的数据
    for (let i = 1; i < 5; i++) {
      // console.log(i)
      arr.push(+prompt(`请输入第${i}季度的销售额`))
    }
    // console.log(arr);
    // 2·遍历数组，生成页面结构 =>采用字符串拼接的方式
    // 2·1遍历数组，拿到每一项
  
    let str = ''
    for(let j = 0; j < arr.length; j++) {
      // console.log(arr[j])
        // 2·2拼接字符串
      str += `
        <div style="height: ${arr[j]}px;" title="第${j+1}季度-${arr[j]}万">
        <span>${arr[j]}万</span>
        <h4>第${j+1}季度</h4>
      </div>`
    }
    console.log(str)
    //2·3将拼接好的字符串追加到页面中
    document.write(str)
  </script>
  </div>
</body>

</html>